//
// Created by liuhuan on 2022/5/8.
//

#ifndef RUIYAN_PTZ_CALLBACK_H
#define RUIYAN_PTZ_CALLBACK_H

#include <string>
#include "define/DataDefine.h"
#include "control/GndControl.h"
#include <jni.h>
#include <map>

class CallBack {
public:
    static CallBack *getInstance() {
        static CallBack control;
        return &control;
    }

    void init(JNIEnv *env, jobject call_back, JavaVM *vm);

    void detectInfoCB(SKYNODE_GND_DETECTINFOS_S stru, std::vector<BoundingBox> boxs);

    void baseInfoCB(SKYNODE_GND_BASEINFO_S stru);

    void devInfoCB(SKYNODE_GND_DEVINFO_S stru, std::vector<DeviceInfo> vector);

    void trackInfoCB(SKYNODE_GND_TRACKINFO_S stru);

    void ptzPIDInfoCB(SKYNODE_GND_PTZ_PID_S stru);

    void algParamInfoCB(SKYNODE_GND_ALG_PARAM_S stru);

    void test();

private:
    void initMap();

    void initClass();

    void initMethod();

    void initField();

private:
    JavaVM *jvm;
    jclass clz;
    jobject m_obj;
    JNIEnv *m_env = nullptr;

    std::map<std::string, jmethodID> methodIdMap;
};


#endif //RUIYAN_PTZ_CALLBACK_H
